#include "stdafx.h"

#include <iostream>
#include <conio.h>

#include "LUNA_Common.h"
#include "LUNA_SoundManager.h"
#include "LUNA_WAVFactory.h"
#include "LUNA_VorbisFactory.h"
#include "LUNA_ISound.h"

int _tmain(int argc, _TCHAR* argv[])
{
	try
	{
		LUNA::SoundManager soundManager;
		LUNA::WAVFactory wavFactory( soundManager );
		LUNA::VorbisFactory vorbisFactory( soundManager, soundManager.getVorbisSystem() );
		
		soundManager.initialize();
		soundManager.setVolume( 0.5 );

		LUNA::ISound *sound = soundManager.createSound( "grass_step_1.wav", "WAV" );
		//LUNA::ISound *sound = soundManager.createSound( "test.ogg", "VORBIS" );
		sound->setPlayState( LUNA::SPS_PLAY );
		
		while( sound->getPlayState() != LUNA::SPS_STOP )
		{
			Sleep( 20 );
			soundManager.update();
		}

		soundManager.shutdown();
	}
	catch( std::runtime_error &error )
	{
		std::cout << "error: " << error.what() << std::endl;
	}

	while( !_kbhit() );

	return 0;
}

